package fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.administrator.projectmoudle_two.R;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import receiver.UsbReceiver;

/**
 * Created by eyesee on 2017/6/13.
 */

public class UsbMontedFragment extends BaseFragment {
    private static final String TAG= "UsbMontedFragment";
    private View mView;
    private TextView mUsbPath;
    private TextView mUsbPath2;
    private String mText;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mView = View.inflate(mContext, R.layout.fragment_usbmounted, null);
        EventBus.getDefault().register(this);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        initView();
        return mView;
    }

    private void initView() {
        mUsbPath = ((TextView) mView.findViewById(R.id.text_path));
        mUsbPath2 = ((TextView) mView.findViewById(R.id.text_path2));
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void getEvent(UsbReceiver.UsbEvent event){
        mText = event.getText();
        mUsbPath.setText(mText);
    }
}
